<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        
        <title>{% block title %}{% endblock %}</title>
        
        <!-- Bootstrap -->
        <link href="/static/css/bootstrap.css" rel="stylesheet">
        <script src="/static/js/jquery-1.11.0.min.js"></script>
        <script src="/static/js/bootstrap.min.js"></script>
        
        <!-- custom -->        
        <link href="/static/css/custom.css" rel="stylesheet">

        {% block head %}{% endblock %}
    </head>
    
    <body>
        <!-- 导航栏 -->
        <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">Project name</a>
            </div>

            <div class="collapse navbar-collapse">
                {% if user.is_authenticated %}
                    <ul class="nav navbar-nav">
                        <li {% if request.path = '/' %} class="active" {% endif %}><a href="/">Home</a></li>
                        <li {% if 'about' in request.path %} class="active" {% endif %}><a href="/about">关于</a></li>
                    </ul>

                    <ul class="nav navbar-nav navbar-right" style="padding-right: 1%">
                        <li class="dropdown">
                            <a href="" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> {{ request.user.username }} <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href={% url "changepasswordurl" %}>修改密码</a></li>
                                <li class="divider"></li>
                                <li><a href={% url "logouturl" %}>注销登陆</a></li>
                            </ul>
                        </li>
                    </ul>
                {% else %}
                    <ul class="nav navbar-nav">
                        <li {% if 'login' in request.path %} class="active" {% endif %}><a href={% url "loginurl" %}>登陆</a></li>
                        <li {% if 'about' in request.path %} class="active" {% endif %}><a href="/about">关于</a></li>
                    </ul>

                    <ul class="nav navbar-nav navbar-right" style="padding-right: 1%">
                        <li {% if 'help' in request.path %} class="active" {% endif %}><a href="#">帮助</a></li>
                    </ul>
                {% endif %}
            </div>
        </div>

        <!-- 内容区域 -->
        {% block content %}{% endblock %}

        <!-- 页脚 -->
        <div class="col-md-12">
            <hr />
            <p class="text-muted">&copy; System 2014</p>
        </div>

    </body>
</html>
